﻿$(document).ready(function() {

    $('#pane1').jScrollPane({ dragMaxHeight: 10, scrollbarWidth: 9, showArrows: false });

    $('.media_numbers').fadeTo("slow", 0.33);

    $('#contentRight')
		.hover(function() {
		    $('.media_numbers')
				.stop()
				.animate({ 'opacity': 1 }, 300, 'easeOutQuad'); // easing plugin
		}, function() {
		    $('.media_numbers')
				.stop()
				.animate({ 'opacity': 0.33 }, 300, 'easeOutQuad'); // easing plugin
		});



    $('li.vis_link a').each(function(i) {
        // get heights etc for each item
        this.myHeight = $(this).parent().outerHeight(); // dimensions plugin dependency
        
        this.inPos = this.myHeight;
        this.outPos = this.myHeight - $(this).children('span.link_panel').outerHeight();
        
        // reposition link text elements at bottom (part overflowing)
        $(this).children('span.link_panel').css({
            'position': 'absolute',
            'top': this.inPos + 'px'

        });
        $(this)
        
        /* keyboard access binding */
			.bind("mouseenter focus", function() {
			    $(this).parent().addClass('focal');
			    $('li.vis_link:not(.focal)')
					.stop()
					.animate({ 'opacity': 0.6 }, 300, 'easeOutQuad'); // easing plugin
			    var $outPos = this.outPos;

			    $(this).children('span.link_panel')
					.stop()
					.animate({ 'top': $outPos + 'px' }, 300, 'easeOutQuad'); // easing plugin

			})
			.bind("mouseleave blur", function() {
			    $('li.vis_link:not(.focal)')
					.stop()
					.animate({ 'opacity': 1 }, 300, 'easeOutQuad'); // easing plugin
			    $(this).parent().removeClass('focal');
			    var $inPos = this.inPos;
			    $(this).children('span.link_panel')
					.stop()
					.animate({ 'top': $inPos + 'px' }, 300, 'easeOutQuad'); // easing plugin
			})
    });


    //end
})